package springboot.tools;

import org.springframework.stereotype.Component;

@Component
public class ConvertByteToBit {
    byte[] array;
    public byte[] byteToBit(byte fromPLC){
        array = new byte[8];
        int b=(byte)fromPLC & 0xFF;
        for (int i = 0; i <= 7; i++) {
            array[i] = (byte)(b & 1);
            b = (byte) (b >> 1);
        }
        return array;
    }
}
